<html>
    
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>
            企业进销存系统
        </title>
        <link rel="stylesheet" href="./css/common.css" type="text/css" media="screen"/>
        <script type="text/javascript" src="./js/jquery-1.8.3.min.js"></script> 
    </head>
    
    <body id="taa">
        
        <div class="tableremain">
            <div class="ttitile">
                <h1 >苏宁店</h1>
            </div>
            <table>
                <tr>
                    <td style="width:200px">产品编号</td>
                    <td style="width:400px">产品名称</td>
                    <td style="width:200px">库存数量</td>
                </tr>
                <tr>
                    <td>asd</td>
                    <td>asd</td>
                    <td>asd</td>
                </tr>
                <tr>
                    <td>asd</td>
                    <td>asd</td>
                    <td>asd</td>
                </tr>
                <tr>
                    <td>asd</td>
                    <td>asd</td>
                    <td>asd</td>
                </tr>
            </table>
        </div>
        <br>
        <div class="tableremain">
            <div class="ttitile">
                <h1 >龙哥店</h1>
            </div>
            <table>
                <tr>
                    <td style="width:200px">产品编号</td>
                    <td style="width:400px">产品名称</td>
                    <td style="width:200px">库存数量</td>
                </tr>
                <tr>
                    <td>asd</td>
                    <td>asd</td>
                    <td>asd</td>
                </tr>
                <tr>
                    <td>asd</td>
                    <td>asd</td>
                    <td>asd</td>
                </tr>
                <tr>
                    <td>asd</td>
                    <td>asd</td>
                    <td>asd</td>
                </tr>
            </table>
        </div>
        asfsafsafsa
    </body>
    <script>
        
        $(document).ready(function(){
            $.ajax({
                type : "POST",
                url : "/jxc/stockalert.do",
                async:false,
                data:{},
                contentType: "application/x-www-form-urlencoded; charset=UTF-8",
                dataType : 'json',
                success : function(data) {
                    //alert(data.result);
                    if(data.result===null){
                        
                    }else{
                        aaa="";
                        $.each(data.result, function(index, alertjson) {
                            aaa+='<div class="tableremain"><div class="ttitile"><h1 >'+alertjson.shopname+'</h1></div>';
                            aaa+='<table><tr><td style="width:200px">产品编号</td><td style="width:400px">产品名称</td><td style="width:200px">库存数量</td></tr>'
                            $.each(alertjson.pd, function(index, productjson) {
                                aaa+='<tr><td>'+productjson.productid+'</td><td>'+productjson.productname+'</td><td>'+productjson.num+'</td></tr>';
                            });
                            aaa+='</table></div>';
                        }); 
                        $("#taa").html(aaa);
                    }
                    $('.tableremain td').attr('class','tabletd');
                    
                },
                error : function(data) {
                   alert("error");
                }                  
            });
        });
            </script>
    <script>
        function clickLog() {
            //alert($('#type').val());
            type=0;
            switch($('#type').val()){
                case "超级管理员":type=0;break;
                case "供应商管理员":type=1;break;
                case "订单管理员":type=2;break;
                case "仓库管理员":type=3;break;
            }
            alert(type);

            if($('#adminrname').val()===""||$('#adminuname').val()===""||$('#adminopwd').val()===""
                ||$('#adminnpwd').val()===""){
                alert("请填满除备注以外的所有内容");
            } 

            else if($('#adminopwd').val()===$('#adminnpwd').val()){
                $.ajax({
                    type : "POST",
                    url : "/jxc/addadmin.do",
                    async:false,
                    data:{
                        "userid":$('#adminuname').val(),
                        "pwd":$('#adminopwd').val(),
                        "name":$('#adminrname').val(),
                        "bz":$('#remarks').val(),
                        "type":type
                    },
                    contentType: "application/x-www-form-urlencoded; charset=UTF-8",
                    dataType : 'json',
                    success : function(data) {
                        //alert(data.result);
                        if(data.result===1){
                            alert("用户名已存在请重新输入");
                            $('#adminuname').val("");
                            $('#adminopwd').val("");
                            $('#adminnpwd').val("");
                        }else{
                            alert("添加成功");
                            location.href='';
                        }
                        
                    },
                    error : function(data) {
                       alert("error");
                    }            
                      
                });

            }else{
                alert("两次输入的密码不一致");
            }   
        }
    </script>

</html>